/*
   Copyright (c) 2019 Shanghai Xuanzi Technology Co. Ltd https://xuanzi.ltd
   XZMindMap is licensed under the Mulan PSL v1.
   You can use this software according to the terms and conditions of the Mulan PSL v1.
   You may obtain a copy of Mulan PSL v1 at:
      http://license.coscl.org.cn/MulanPSL
   THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
   IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
   PURPOSE.
   See the Mulan PSL v1 for more details.

*/

package xuanzi.openmind.renders;

import xuanzi.commons.graphics.Canvas;
import xuanzi.openmind.lines.TreeLine;
import xuanzi.openmind.nodes.Node;

public class LineNodeRender extends DefaultNodeRender {
	
	TreeLine line = new TreeLine();

	public LineNodeRender() {
		// TODO Auto-generated constructor stub
	}
	
	@Override
	protected void drawShape(Canvas canvas, RenderBuffer node) {
		// TODO Auto-generated method stub
		//super.drawShape(canvas, node);
	}
	
	@Override
	protected void drawLines(Canvas canvas, Node node) {
		// TODO Auto-generated method stub
		super.drawLines(canvas, node);
	}

	protected void drawLine(Canvas canvas, Node node, Node item, int index) {
		line.setNode(node);
		line.draw(canvas, node, item);
	}
	
	@Override
	protected void drawHandler(Canvas canvas, Node node) {
		// TODO Auto-generated method stub
		//super.drawHandler(canvas, node);
	}
	
	@Override
	protected void drawLabel(Canvas canvas, RenderBuffer node) {
		if(node.labelBox!=null) { 
			paint.borderSize = 1; 
			{
			//	paint.fill(node.labelBackgroundColor);
			//	canvas.drawRect(node.labelBox, paint); 
			  
			}{
				paint.fill(node.textColor);
				paint.textSize = (int) (node.textSize*0.8);
				canvas.drawText(node.label,node.labelBox.centerX(), node.labelBox.centerY()-1.2f,paint);
			}
		}
	} 
}
